package com.perye.dokit.mobileController;

import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.perye.dokit.aop.log.Log;
import com.perye.dokit.base.BaseController;
import com.perye.dokit.entity.WeWeddingStyle;
import com.perye.dokit.query.WeWeddingStyleQueryCriteria;
import com.perye.dokit.service.WeWeddingStyleService;
import com.perye.dokit.service.WeddingTypeService;
import com.perye.dokit.utils.ArrayAssembly;
import com.perye.dokit.utils.DateUtils;
import com.perye.dokit.utils.UploadFile;
import com.perye.dokit.utils.pageData.PageData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.List;


@Api(tags = "styleList管理")
@RestController
@RequestMapping("/app/weddingStyle")
public class WeWeddingAppStyleController extends BaseController {

    @Autowired
    private WeddingTypeService weddingTypeService;
    @Value("${uploadFilePath}")
    String uploadFilePath;

    @Value("${uploadFileMapping}")
    String uploadFileMapping;
    private final WeWeddingStyleService weWeddingStyleService;

    public WeWeddingAppStyleController(WeWeddingStyleService weWeddingStyleService) {
        this.weWeddingStyleService = weWeddingStyleService;
    }



    @Log("查询styleList")
    @ApiOperation("查询styleList")
    @GetMapping()
    @RequestMapping("/selWeWeddingStyles")
    public PageData selWeWeddingStyles()throws Exception{
        PageData result = new PageData();
        try {
            PageData pageData = this.getPageData();
//            int page = Integer.parseInt(pageData.getString("page")) + 1;
//            PageHelper.startPage(page, Integer.parseInt(pageData.getString("size")));
            pageData.put("isOpen",1);//'是否开启：0：未开启，1：已开启',
            List<PageData> deptDtos = weWeddingStyleService.selectWeddingStyle(pageData);

            result.put("data", deptDtos);
            result.put("code", "00");
            result.put("msg", "查询成功");
        } catch (Exception e) {

            e.printStackTrace();
        }
        return result;
    }

}
